<div class="container config-agreement-container">
	<div class="control-group">
		<br />
		<div>
			<button class="u-btn-blue" {{action "openDialog"}}>添加协议分析器</button>
		</div>
	</div>
	
	<div class="tab-content">
		{{view view.Grid
			columns=agreementColumns
			content=agreementList
			pageIndex=pageIndex
			allowPaging=true
			pageSize=pageSize
			totalRows=totalRows
			allowSorting=true
			sorted="gridSorted"
			pageIndexChanged="pageIndexChanged"
			class=""}}
	</div>
</div>
<div id="dataPackageFilterInfo" class="hide dataFilter">
	<form class="form-horizontal">
		<div class="dataFilterTitle">
			数据包过滤规则
		</div>
		<div class="tip-wrap">
			<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		</div>

		<div class="container form-horizontal">
			<div class="control-group">
				<div class="control-group pickerfilter-options">
					{{!-- <button class="u-btn-danger op-delete" {{action "delPolicy"}} disabled={{noneRulesChecked}}>删除</button> --}}
					<button class="u-btn-blue op-add" {{action "openDataFilterDialog"}}>添加</button>
					{{!-- <button class="u-btn-blue op-save" {{action "save"}}>保存</button> --}}
				</div>
				<div class="conf-dataPacket-content">
					<table class="conf-table conf-packetf-tab wijmo-wijgrid-table">
						<thead>
							<tr>
								{{!-- <th class="config-tab-th tc" width="80">
									{{input type="checkbox" checked=checkedAll}}
								</th> --}}
								<th class="config-tab-th" width="130">源IP</th>
								<th class="config-tab-th" width="80">源端口</th>
								<th class="config-tab-th" width="130">目的IP</th>
								<th class="config-tab-th" width="80">目的端口</th>
								<th class="config-tab-th">策略</th>
								<th class="config-tab-th">操作</th>
							</tr>
						</thead>
						<tbody>
							{{#each policyRules as |policyRule|}}
							<tr class="wijmo-wijgrid-row">
								{{!-- <td class="tc">
									{{input type="checkbox" checked=policyRule.checked}}
								</td> --}}
								<td>
									{{policyRule.sIp}}
								</td>
								<td>
									{{policyRule.sPort}}
								</td>
								<td>
									{{policyRule.dIp}}
								</td>
								<td>
									{{policyRule.dPort}}
								</td>
								<td>
									{{policyRule.policyName}}
								</td>
								<td>
									<button class="u-btn-danger" {{action "singleDelPolicy" policyRule bubbles=false}}>删除</button>
									<button class="u-btn-blue" {{action "upPriority" policyRule bubbles=false}} title="上移">上移</button>
									<button class="u-btn-blue" {{action "downPriority" policyRule bubbles=false}} title="下移">下移</button>
								</td>
							</tr>
							{{else}}
							<tr>
								<td colspan="7" class="tc">当前没有数据</td>
							</tr>
							{{/each}}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</form>
</div>


{{#view view.Dialog
	id="configAgreement_add"
	title="添加协议分析器" 
	autoOpen=false
	modal=true
	width=400
	height=380
	class="agreement-adduser"
	resizable=false
	buttons=dialogButtons}}
	<div id="dialog">
		<div {{bind-attr class=":alert alertType formTip::hide"}}><strong>{{formTip}}</strong></div>
		<div class="control-group">
			<label class="adduser-title">IP</label>
			<div class="adduser-content">
				{{input class="input u-input-blue" value=form.ip placeholder="请输入ip"}}
			</div>
		</div>
		<div class="control-group">
			<label class="adduser-title">端口</label>
			<div class="adduser-content">
				{{input class="input u-input-blue" value=form.port placeholder="请输入端口"}}
			</div>
		</div>
		<div class="control-group">
			<label class="adduser-title">备注</label>
			<div class="adduser-content">
				{{textarea class="input u-input-blue no-resize" value=form.memo}}
			</div>
		</div>
		<div class="control-group">
			<div class="adduser-content adduser-options">
				<button type="submit" {{action "addAgreement"}} class="u-btn-blue">确定</button>
				<button type="button" {{action "closeDialog"}} class="u-btn-blue">取消</button>
			</div>
		</div>
	</div>	
{{/view}}

{{#view view.Dialog
	id="configAgreementLog"
	class=""
	title="协议分析器日志"
	autoOpen=false
	modal=true
	width=800
	height=600
	buttons=dialogButtons}}

	{{!-- {{#each agreementLogs as |log|}}
		<div class="" style="border-bottom:1px solid #ccc">
			<div class="control-group error-info">
				<table class="apm-table">
					<tr>
						<td>
							<h5 class="title">协议名称</h5>
							<div>{{log.proto_name}}</div>
						</td>
						<td>
							<h5 class="title">分析器版本</h5>
							<div>{{log.version}}</div>
						</td>
						<td>
							<h5 class="title">最后操作时间</h5>
							<div>{{log.callTime}}</div>
						</td>
					</tr>
				</table>
			</div>
			<div class="control-group stack-errormsg">
				<h5>状态信息</h5>
				{{log.errorMessage}}
			</div>
		</div>
	{{/each}} --}}
	<div class="tab-content" id="config-modulel7-log">
		<table class="conf-table conf-modulel7-tab">
			<tr>
				<th class="config-modulel7-tab1">
					L7模块
				</th>
				<th class="config-modulel7-tab1">
					版本
				</th>
				<th class="config-modulel7-tab1">
					状态
				</th>
				<th class="config-modulel7-tab5">
					时间
				</th>
				<th class="config-modulel7-tab4">
					错误信息
				</th>
			</tr>
			{{#each agreementLogs as |log|}}
			<tr>
				<td class="config-tab-td">
					{{log.proto_name}}
				</td>
				<td class="config-tab-td">
					{{log.version}}
				</td>
				<td class="config-tab-td log-status">
					{{log.status}}
				</td>	
				<td class="config-tab-td">
					{{log.callTime}}
				</td>	
				<td class="config-tab-td">
					{{log.errorMessage}}
				</td>	
			</tr>
			{{/each}}
		</table>
	</div>
{{/view}}
{{!-- 协议分析器相关内容 --}}
{{#view view.Dialog
	id="packet_filter_add"
	title="添加过滤策略"
	autoOpen=false
	modal=true
	width=600
	height=450 
	class="common-popUp filter-add"
	buttons=dialogButtons}}
	<div id="dialog">
		<div {{bind-attr class=":alert alertType saveResult::hide"}}><strong>{{saveResult}}</strong></div>
		<div class="control-group">
			<label class="group-title">源IP</label>
			<div class="group-content">
				{{input class="input u-input-blue" value=form.sourceIp}}&nbsp;&nbsp;-&nbsp;
				{{input class="input u-input-blue" value=form.sourceIp1 tooltip="源IP地址范围，如192.168.0.1表示单机,192.168.0.1-192.168.0.10表示范围" }}
			</div>
		</div>

		<div class="control-group">
			<label class="group-title">源端口</label>
			<div class="group-content">
				{{input class="input u-input-blue" value=form.sourcePort}}&nbsp;&nbsp;-&nbsp;
				{{input class="input u-input-blue" value=form.sourcePort1 tooltip="源端口范围，如8080表示单个端口， 80-1000表示范围"}}
			</div>
		</div>

		<div class="control-group">
			<label class="group-title">目的IP</label>
			<div class="group-content">
				{{input class="input u-input-blue" value=form.dstIp}}&nbsp;&nbsp;-&nbsp;
				{{input class="input u-input-blue" value=form.dstIp1 tooltip="IP地址范围，如192.168.0.1表示单机,192.168.0.1-192.168.0.10表示范围" }}
			</div>
		</div>

		<div class="control-group">
			<label class="group-title">目的端口</label>
			<div class="group-content">
				{{input class="input u-input-blue" value=form.dstPort}}&nbsp;&nbsp;-&nbsp;
				{{input class="input u-input-blue" value=form.dstPort1 tooltip="端口范围，如8080表示单个端口， 80-1000表示范围"}}
			</div>
		</div>
		<div class="control-group">
			<label class="group-title">策略</label>
			<div class="group-content">
				{{!-- {{view "select"
				class="span4 u-input-blue"
				content=defaultpolicys
				optionLabelPath="content.displaytext"
				optionValuePath="content.value"
				value=form.policys}} --}}

				{{view view.parentView.select 
					class="form-top-select form-top-select-app span4"
					content=defaultpolicys
					selectValue=form.policys
					optionLabelPath="displaytext"
					optionValuePath="value"
				}} 
			</div>
		</div>

		<div class="control-group">
			<div class="group-options">
				<button type="button" {{action "addPolicy" bubbles=false}} class="u-btn-blue">确定</button>
				<button type="button" {{action "closeDataFilterDialog" bubbles=false}} class="u-btn-blue">取消</button>
			</div>
		</div>
	</div>	
{{/view}}